package ferp.center.server.entity;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.Text;

import javax.persistence.*;
import java.util.Date;

@Entity
public class Report
{
  public Key getKey() {return key;}
  public Date getCreated() {return created;}
  public void setCreated(Date created) {this.created = created;}
  public String getAppVersion() {return appVersion;}
  public void setAppVersion(String version) {appVersion = version;}
  public String getName() {return name;}
  public void setName(String name) {this.name = name;}
  public String getEmail() {return email;}
  public void setEmail(String email) {this.email = email;}
  public String getDescription() {return description.getValue();}
  public void setDescription(String description) {this.description = new Text(description);}
  public boolean getSent() {return sent;}
  public void setSent(boolean sent) {this.sent = sent;}
  public String getSnapshot() {return snapshot.getValue();}
  public void setSnapshot(String snapshot) {this.snapshot = (snapshot == null ? null : new Text(snapshot));}
  public String getSettings() {return settings.getValue();}
  public void setSettings(String settings) {this.settings = (settings == null ? null : new Text(settings));}
  public String getStatistics() {return statistics == null ? null : statistics.getValue();}
  public void setStatistics(String statistics) {this.statistics = (statistics == null ? null : new Text(statistics));}
  public String getException() {return exception.getValue();}
  public void setException(String exception) {this.exception = (exception == null ? null : new Text(exception));}
  public String getService() {return service;}
  public void setService(String service) {this.service = service;}
  //public void setHand(String hand) {this.hand = new Text(hand);}

  @Id
  @GeneratedValue(strategy= GenerationType.IDENTITY)
  private Key key;
  // report creation date
  @Temporal(TemporalType.DATE)
  private Date created;
  // app version
  private String appVersion;
  // name
  private String name;
  // email
  private String email;
  // description
  private Text description;
  // was report sent by email
  private boolean sent;
  // snapshot JSON
  private Text snapshot;
  // settings JSON
  private Text settings;
  // statistics JSON
  private Text statistics;
  // exception
  private Text exception;
  // service statistics
  private String service;
  // hand and move candidates information
  //private Text hand;

  @Version
  private int version;
}
